<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="com.wh.wisdomsite.xbox.core.ServiceDispatcher" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html>
<head>
    <title>招商贷-数据插件管理系统v1.0</title
    <%@ include file="/WEB-INF/views-jsp/include/taglib/taglib.jsp" %>
    <%@ include file="/WEB-INF/views-jsp/include/meta/meta.jsp" %>
    <%@ include file="/WEB-INF/views-jsp/include/link/link.jsp" %>
    <%@ include file="/WEB-INF/views-jsp/include/script/script.jsp" %>
    <link href="${path}/html/tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
    <script type="text/javascript" src="${path}/html/js/js-jsp/browser.js"></script>
    <script type="text/javascript" src="${path}/html/js/js-jsp/dataServices/requestPage.js"></script>
</head>
<body>
<div>
    <form action="${pageContext.request.contextPath}/service" target="_blank" method="post" id="requestForm">
        <!--设置默认数据格式为： json-->
        <input type="hidden" id="format" name="format" value="json"/>
        <!--设置默认系统平台为：SHIFT_APP-->
        <input type="hidden" id="client" name="client" value="WH_APP"/>
        <table class="requestTable">
            <tr>
                <th width="80" style="text-align: right">应用KEY：</th>
                <td>
                    <select name="appKey" id="appKey"></select>
                </td>
            </tr>
            <tr>
                <th style="text-align: right">服务方法：</th>
                <td>
                    <select name="method" id="method"></select>
                </td>
            </tr>
            <tr>
                <th style="text-align: right">调用方式：</th>
                <td>
                    <select name="executionType" id="executionType">
                        <option value="SYNC" selected="selected">SYNC</option>
                        <option value="ASYNC">ASYNC</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th style="text-align: right">服务版本：</th>
                <td>
                    <select name="version" id="version"></select>
                </td>
            </tr>
            <tr>
                <th style="text-align: right">应用类型：</th>
                <td>
                    <select name="callType" id="callType">
                        <option value="ANDROID">ANDROID</option>
                        <option value="IOS">IOS</option>
                        <option value="WAP">WAP</option>
                        <option value="PC" selected="selected">PC</option>
                    </select>
                </td>
            </tr>
            <tr>
                <th style="text-align: right">应用版本：</th>
                <td>
                    <input name="callVersion" id="callVersion" value="1.0.0" />
                </td>
            </tr>
            <tr>
                <th style="text-align: right">会话标识：</th>
                <td>
                    <input name="sessionId" id="sessionId" />
                </td>
            </tr>
            <tr>
                <th style="text-align: right">应用品牌：</th>
                <td>
                    <input name="appBrand" id="appBrand" value="" readonly="readonly" style="float: left;  background: #e5e1e1" /> &nbsp;&nbsp;
                    <span style="color: red; font-weight: bold; float: left; margin-top: 4px; margin-left: 10px; ">注：[应用品牌]和[应用信息]由应用类型自动识别。(原生ANDROID，IOS无法识别为空)</span>
                </td>
            </tr>
            <tr>
                <th style="text-align: right; vertical-align: top; padding-top: 10px">应用信息：</th>
                <td>
                    <textarea rows="3" cols="100" name="appBaseInfo" id="appBaseInfo" readonly="readonly" style="float: left; line-height: 22px; background: #e5e1e1"  ></textarea>
                </td>
            </tr>
            <tr>
                <th style="text-align: right; vertical-align: top; padding-top: 10px">业务参数：</th>
                <td>
                    <textarea rows="5" cols="100" name="bindObject" id="bindObject" style="line-height: 22px"></textarea>
                </td>
            </tr>
            <%
                ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());
                ServiceDispatcher serviceDispatcher = (ServiceDispatcher)context.getBean("serviceDispatcher");
                boolean isSign = serviceDispatcher.getXboxContext().isSignEnable();
                if(isSign){
                    %>
                    <tr>
                        <th style="text-align: right">签名配置：</th>
                        <td>
                            <input name="sign" id="sign" style="float: left;  background: #e5e1e1" readonly="readonly" />
                            &nbsp;&nbsp;
                            <span style="color: red; font-weight: bold; float: left; margin-top: 4px; margin-left: 10px; ">注：按接口服务调用标准，[由上向下先选择或填写参数（业务参数 + 会话标识）] 再生成签名参数。</span>
                        </td>
                    </tr>
                    <%
                }
            %>
            <tr>
                <td colspan="2" style="background: transparent">
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon_export_user'" id="createBindObject" onclick="createBindObject()">生成业务参数</a>&nbsp;
                    <%
                        if(isSign){
                            %><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon_export_user'" onclick="createSign()">生成签名配置</a>&nbsp;<%
                        }
                    %>
                    <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-group-state-ok'" onclick="requestFormSumbit('<%=isSign %>')" >测试</a>
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>